package com.jiajia.study.mylist.circle;

/**
 * @author zjiajia
 * @date 2021/1/16 23:14
 */
public class Client {

    public static void main(String[] args) {
        test();
//        test2();
    }

    /**
     * 测试环形队列
     */
    public static void test(){
        CircleQueue<Integer> queue = new CircleQueue<>();
        for (int i = 0; i < 10; i++) {
            queue.enQueue(i);
        }
        System.out.println(queue);

        for (int i = 0; i < 5; i++) {
            System.out.println(queue.deQueue());
        }

        for (int i = 15; i < 20 ; i++) {
            queue.enQueue(i);

        }
        System.out.println(queue);
        while(!queue.isEmpty()){
            System.out.println(queue.deQueue());
        }
    }

    /**
     * 测试队列的扩容
     */
    public static void test2(){
        CircleQueue<Integer> queue = new CircleQueue<>();
        for (int i = 0; i < 10; i++) {
            queue.enQueue(i);
        }
        System.out.println(queue);

        for (int i = 0; i < 6; i++) {
            System.out.println(queue.deQueue());
        }

        for (int i = 15; i < 30 ; i++) {
            queue.enQueue(i);

        }
        System.out.println(queue);
        while(!queue.isEmpty()){
            System.out.println(queue.deQueue());
        }
    }
}
